<?php
/**
 * Created by PhpStorm.
 * User: Jerry
 * Date: 2016/12/17
 * Time: 11:52
 */

namespace YMApi\Controller;


use SDXApi\Service\SeminarService;

/**
 * Class SeminarController
 * @package SDXApi\Controller
 */
class SeminarController extends AppController
{

	/**
	 * 返回数据
	 * Created by Jerry
	 */
	public function get_seminar_template_page()
	{
		$user_id = I('post.uid', 0, 'int');
		$id = I('post.seminar_id', 0, 'int');
		$wid = I('post.wid', 0, 'int');
		$is_show = I('post.is_show', 0, 'int');

//		if (empty($user_id)) {
//			returnApiError('请先登录');
//		}

		if (empty($id) || empty($wid)) {
			returnApiError('非法请求');
		}
		$data = array();

		$seminarService = new SeminarService($user_id, $wid);
		$seminarService->is_show = $is_show;
		$template = $seminarService->getTemplateById($id);

		if (empty($template)) {
			returnApiError('暂无数据');
		}

		$data['seminar_name'] = $template['name'];
		$data['desc'] = $template['desc'];
		$data['seminar_list'] = $seminarService->findSeminarTemplatePageById($id);

		if (empty($data)) {
			returnApiError('暂无数据');
		}

		returnApiSuccess($data);
	}
}